package com.github.zdg.recyclerview.itemdecoration;

import android.support.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Created by zoudong on 2017/4/9.
 */

public class Edge {

    public static final int NO_EDGE = 0x01 << 0;
    public static final int LEFT_EDGE = 0x01 << 1;
    public static final int TOP_EDGE = 0x01 << 2;
    public static final int RIGHT_EDGE = 0x01 << 3;
    public static final int BUTTOM_EDGE = 0x01 << 4;

    @IntDef({
            LEFT_EDGE,
            TOP_EDGE,
            RIGHT_EDGE,
            BUTTOM_EDGE,
    })
    @Retention(RetentionPolicy.SOURCE)
    private @interface OffEdge {
    }
    @OffEdge
    private int mOffEdge = LEFT_EDGE | RIGHT_EDGE | TOP_EDGE | BUTTOM_EDGE;

    public Edge() {
    }

    public Edge(int offEdge) {
        this.mOffEdge = offEdge;
    }

    public  boolean isShowEdge(int edge) {
        return (mOffEdge & edge) == edge;
    }
    public  void removeEdge(int edge){
          mOffEdge &= ~edge;
    }

    public void addEdge(int edge) {
        mOffEdge|=edge;
    }
}
